class Book(var name:String,var author:String,var ISBN:String){
  def borrow(book:String):Unit={
    printf("借出了%s\n",book)
  }
  def back(book:String){
    printf("归还了%s\n",book)
  }
}
object Book{
  def apply(name:String,author:String,ISBN:String)={
    new Book(name,author,ISBN)}
  def unapply(b:Book):Option[(String,String,String)]={
    Some((b.name,b.author,b.ISBN))
  }
}
class Library{
  var vlist=List("计算机网络")//可用书列表
  var ulist=List("数据结构")//已借出书列表
  def addBook(book:String){
    vlist=vlist:+book
    printf("添加新书成功，当前可用书籍列表为%s\n",vlist)
  }
  def borrowBook(book:String){
    ulist=ulist.filter(_!=book)
    printf("借书成功，当前已借出书籍列表为%s\n",vlist)
  }
  def backBook(book:String){
    vlist=vlist:+book
    printf("归还书籍成功，当前可用书籍列表为%s\n",vlist)
  }
}
object Library{
  def apply()={new Library}
}
object Test{
  def main(args:Array[String]){
    var book=Book("python数据分析","曹雪芹","9787558909047")
    book.borrow("西游记")
  }
}
